package com.csx.base.design.behavior.chainOfResponsibility;

/**
 * @author cuisongxu
 * @date 2022/9/28 11:58
 */
public abstract class Approver {

    /**
     * 抽象出审批人的名称
     */
    protected String name;

    /**
     * 下一位审批人，更高级别的领导
     */
    protected Approver nextApprover;

    public Approver(String name) {
        this.name = name;
    }

    protected Approver setNextApprover(Approver nextApprover) {
        this.nextApprover = nextApprover;
        // 返回下一位审批人，支持链式编程
        return this.nextApprover;
    }

    /**
     * 抽象审批方法 - 由具体的审批人实现
     * @param amount
     */
    public abstract void approve(int amount);
}
